﻿#ifndef SVCALCULATEMODEL_H
#define SVCALCULATEMODEL_H

#include <QImage>
#include <QObject>
#include <QPair>
#include <qmath.h>

#include "SVMemoryPool.h"

class SVCalculateModel : public QObject
{
    Q_OBJECT
public:
    SVCalculateModel(QObject *parent = nullptr);

    PCBTemplateFeatures extractFeatures(const QImage &image);

    void matchPCBTemplate(const QImage &image, const std::vector<PCBTemplateFeatures> &templates);
    QList<QRect> detectDifferenceRegions(const QImage &image);

public:
    cv::Mat calculatePerspectiveMatrix(const cv::Mat &mat, cv::Size size);
    cv::Rect warpRectBack(const cv::Rect &rect, const cv::Mat &M);

public:
    cv::Ptr<cv::ORB> mOrbMat;
    cv::Mat mStandardMat;
    cv::Mat mOpenKernel;
    cv::Mat mCloseKernel;
};

#endif
